package com.zb.internetSpider;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.zb.internetSpider.gui.Run;
/**
 * <p>程序启动入口类</p>
 * @author 张贝
 *
 */

public class EntryRun {
	
	private final static Logger LOGGER = LogManager.getLogger(EntryRun.class);
	
	/**
	 * <p>加载spring配置</p>
	 */
	public  static ApplicationContext loadSpring() {
		ApplicationContext applicationContext = new ClassPathXmlApplicationContext("application.xml");
		Run.setApplicationContext(applicationContext);
		return applicationContext;
	}
		
	public static void main(String[] args)  {
		ApplicationContext applicationContext = EntryRun.loadSpring();
		Run run = (Run) applicationContext.getBean("run");			
//		run.initMenu();
		boolean state = run.show();
		if(state)
			LOGGER.debug("爬虫启动成功");
		else {
			LOGGER.error("爬虫启动失败");
			System.exit(0);
			}
	}
	
	
}
